home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format CD 43
/
Amiga Format CD43 (1999)(Future Publishing)(GB)(Track 1 of 2)[!][issue 1999-09].iso
/
-serious-
/
misc
/
gethelp
/
source
/
report.c
< prev
Wrap
C/C++ Source or Header
|
1999-06-14
|
2KB
|
80 lines
#include <stdio.h>
void start_report(fp, target, case_flag, whole_flag, nfiles)
FILE *fp;
char *target;
int case_flag;
int whole_flag;
int nfiles;
{
fprintf(fp,"<HTML>\n");
fprintf(fp,"\t<HEAD>\n");
fprintf(fp,"\t\t<TITLE>\n");
fprintf(fp,"Search results for '%s'\n",target);
fprintf(fp,"\t\t</TITLE>\n");
fprintf(fp,"\t</HEAD>\n");
fprintf(fp,"\t<BODY bgcolor=white>\n");
fprintf(fp,"<H1 ALIGN=CENTER>\n");
fprintf(fp,"<BR>\n");
fprintf(fp,"<B>Search Report</B>");
fprintf(fp,"</H1>\n");
fprintf(fp,"<BR>\n");
fprintf(fp,"Search for word or phrase '<B><FONT COLOR=darkblue>%s</FONT></B>'<BR><BR>\n",target);
if (case_flag)
fprintf(fp,"Attempting to make a case-sensitive match...<BR>\n");
else
fprintf(fp,"Ignoring upper/lower case...<BR>\n");
if (!whole_flag)
fprintf(fp,"Accepting partial word matches...<BR>\n");
else
fprintf(fp,"Matching whole words only...<BR>\n");
fprintf(fp,"<HR>\n");
fprintf(fp,"<H4><B>Search Results</B></H4>\n");
fprintf(fp,"<BR>\n");
fprintf(fp,"Number of files examined: %d<BR>", nfiles);
}
void add_url(fp, file_name, title)
FILE *fp;
char *file_name;
char *title;
{
fprintf(fp,"<UL><LI><A HREF=%s>%s</A></UL>\n", file_name, title);
}
void finish_report(fp, nfound)
FILE *fp;
int nfound; /* number of target files found */
{
/* display error line if none found */
switch (nfound) {
case 0:
fprintf(fp,"<BR>\n");
fprintf(fp,"<F0NT C0L0R=red><B>No files found containing this text...</B>\n");
break;
case 1:
fprintf(fp,"<FONT COLOR=darkgreen><B>One file matches your search.</B>\n");
break;
default:
fprintf(fp,"<FONT COLOR=darkgreen><B>%d files match your search.</B>\n",nfound);
break;
}
fprintf(fp,"<BR><HR>\n");
fprintf(fp,"\t</BODY>\n");
fprintf(fp,"</HTML>\n");
}